<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>
  <table border="1">
    <tr>
      <td>照片:</td><td><img :src="user.pic"></td>
    </tr>
    <tr>
      <td>姓名:</td><td>{{user.name}}</td>
    </tr>
    <tr>
      <td>年龄:</td><td>{{user.age}}</td>
    </tr>
    <tr>
      <td>好友:</td>
      <td><ul><li v-for="name in user.friends">{{name}}</li></ul></td>
    </tr>
  </table>
  <input type="button" value="请求数据" @click="f()">
</div>
<!--引入vue框架文件-->
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
<script>
  let v = new Vue({
    el:"body>div",
    data:{
        user:{name:"",age:"",pic:"",friends: []}
    },
    methods:{
      f(){
        //模拟从服务器请求到的数据
        let user = {name:"苍老师",age:18,
          pic:"../day05/a.jpg",friends:["传奇","克晶","成恒"]};
        //把请求到的数据给到和页面进行绑定的v.user
        v.user = user;
      }
    }
  })
</script>
</body>
</html>